/******************************************************************************* 
 * Copyright (C) 2012-2015 Microfountain Technology, Inc. All Rights Reserved. 
 * 
 * Unauthorized copying of this file, via any medium is strictly prohibited.   
 * Proprietary and confidential
 * 
 * Last Modified: 2015-11-25 13:52:18
 ******************************************************************************/
package cn.com.xy.sms.util;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;
import cn.com.xy.sms.sdk.util.StringUtils;

public class ParseClassifyManager {

    public static Map<String, Object> parseClassifyMsg(Context ctx, String phoneNumber, String smsCenterNum, String smsContent, Map<String, String> extend) throws Exception {
        if (ctx == null) {
            throw new Exception(" Context is null.");
        }

        if (phoneNumber == null) {
            throw new Exception(" phoneNumber is null.");
        }
        if (smsContent == null) {
            throw new Exception(" smsContent is null.");
        }

        Map<String, Object> res = ParseManager.parseMsg(ctx, phoneNumber, smsCenterNum, smsContent, 0l, extend);

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("Result", false);
        if (res != null) {
            String titleNo = (String) res.get("title_num");
            if (!StringUtils.isNull(titleNo) && (titleNo.startsWith("01") || titleNo.startsWith("02") || titleNo.startsWith("03") || titleNo.startsWith("06") || titleNo.startsWith("08") || titleNo.startsWith("14"))) {
                map.put("Result", true);
            }
        }
        return map;
    }
}
